/*  ----------------------------------------------------------------------------
 *  Arello Mobile
 *  Fast 3d Engine
 *  ----------------------------------------------------------------------------
 * Except where otherwise noted, this work is licensed under
 * http://creativecommons.org/licenses/by/3.0
 */
#pragma once

#include "AbstractSequence.h"

namespace liba {
namespace lib3d {
namespace hard {
class Hardware;
class RenderTexture;
} // namespace hard
namespace anim2d {

class Sequence : public AbstractSequence
{
public:
	Sequence();
	Sequence(const Sequence& rhs);

	virtual size_t get_frames_count() const;
	virtual void render_to_list(hard::Hardware * hardware, hard::RenderTexture * render_texture, unsigned frame_number);
	virtual AbstractSequence* clone() const;

	virtual unsigned int GetImageIndexLength()
	{
		return image_index_length;
	}

	virtual void SetImageIndexLength(unsigned int value)
	{
		image_index_length = value;
		load_image(image_name);
	}

	virtual std::string GetType() const
	{
		return "Sequence";
	}
protected:
	virtual bool on_attribute(xml::Provider * prov, const std::string & name, const std::string & value);
	virtual void on_save_attributes(xml::SaverBase * saver) const;

	AutoContainer<std::vector<material::Texture *> > frames;
	unsigned image_index_length;

	void load_image(const std::string & image_name);//## virtual
};

} // namespace anim2d
} // namespace lib3d
} // namespace liba

using namespace liba;
